<template>
    <div>
        <form>
            <label for="">手机号</label><input type="text" v-model="mobile"><br>
            <label for="">密&#x3000;码</label><input type="text" v-model="password"><br>
            <input type="button" @click="login" value="登录"/>
            <input type="button" @click="exit" value="取消"/>
        </form>
    </div>
</template>
<script>
import {ref} from "vue"
import {useStore} from "vuex"
export default{
    setup() {
        const store = useStore()
        var mobile = ref(null);
        var password = ref(null);
        var user = ref(null)
        const login=()=>{
            user.value={
                "mobile":mobile.value,
                "password":password.value,
            }
            store.commit('getusers',user._value)
        }
        const exit=()=>{
            mobile.value=null;
            password.value=null;
        }
        return{
            mobile,
            password,
            login,
            exit,
        }
    },
}
</script>